/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2021-12-10     xu       the first version
 */
#ifndef APPLICATIONS_AMAP_WEATHER_API_H_
#define APPLICATIONS_AMAP_WEATHER_API_H_

#include <rtdef.h>
#include <stdint.h>

struct weather_live_data {
    const char* province;
    const char* city;
    const char* adcode;
    const char* weather;
    const char* temperature;
    const char* wind_direction;
    const char* wind_power;
    const char* humidity;
    const char* report_time;
};

struct weather_cast_data {
    const char* date;
    const char* week;
    const char* day_weather;
    const char* night_weather;
    const char* day_temp;
    const char* night_temp;
    const char* day_wind;
    const char* night_wind;
    const char* day_power;
    const char* night_power;
};

struct weather_forecast_data {
    const char* city;
    const char* adcode;
    const char* province;
    const char* report_time;
    uint32_t ncasts;
    struct weather_cast_data* casts;
};

enum weather_type {
    NONE_WEATHER,
    LIVE_WEATHER,
    FORECAST_WEATHER,
};

typedef enum weather_type weather_type_t;

struct amap_weather_info {
    uint8_t type;
    union {
        struct weather_live_data live_data;
        struct weather_forecast_data forecast_data;
    } data;
};

typedef struct amap_weather_info* amap_weather_info_t;

amap_weather_info_t amap_weather_get(weather_type_t type);
void amap_weather_delete(amap_weather_info_t info);

#endif /* APPLICATIONS_AMAP_WEATHER_API_H_ */
